﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace Senbo.Model.Entities
{
    [Table("Category")]
    public class Category
    {
        [Column(Order = 0)]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }
        [Column(Order = 1)]
        [Key]
        [Required(ErrorMessage = "必须输入GUID")]
        public Guid Guid { get; set; }
        [ScaffoldColumn(false)]
        [DisplayName("类别名称")]
        [Required(ErrorMessage = "必须输入类别名称")]
        [StringLength(20, ErrorMessage = "最多允许输入20个字母（10个中文）")]
        [Column("Name", TypeName = "varchar")]
        public string Name { get; set; }
        [Required(ErrorMessage = "必须输入添加时间")]
        [DisplayName("添加时间")]
        public DateTime AddTime { get; set; }
        public virtual ICollection<Picture> Pictures { get; set; }
        [NotMapped]
        public string Remark { get; set; }
        public Publisher Publisher { get; set; }
    }
    [ComplexType]
    public class Publisher
    {
        public string PublisherName { get; set; }
        public string PublisherAddress { get; set; }
    }
}
